<?php 
## include required files
/*******************************/
require_once '../includefiles.php';

require_once 'chkadminsession.php';
CheckAdminLogin();

require_once("leftmenu.php");
require_once("../model/admindetails.php");
require_once '../model/config.php';
require_once '../model/moduleuser.php';
/*******************************/

## Check admin login

//echo "<pre>"; print_r($_SESSION["admin_id"]); exit;

## Create Objects
/*******************************/
$adminObj = new Model_AdminDetails();
$configObj = new Model_Config();
$moduleObj = new Model_ModuleUser();
/*******************************/

## Stored current time in smarty variable
//$currTime = date("F d, Y H:i:s", time());
$currTime = date("F j, Y, g:i:s a");
$smarty->assign("currTime", $currTime);

## Stored session username	
$adminusername = $_SESSION["admin_user_name"];
$smarty->assign("adminusername", $adminusername);	

## Fetch all modules
$modules = $moduleObj->getAllMasterModules();
$smarty->assign('modules', $modules);
//echo"<pre>";print_r($modules);die();

##fetching admin logo
$logoArr = $configObj->getConfigValueById(1);
$smarty->assign('logoArr', $logoArr);

## Fetch footer logo and text setting
# Footer text
$footer_text = $configObj->getConfigValueById(2);
$smarty->assign('footer_text', $footer_text['config_value']);

# Footer logo
$footer_logo = $configObj->getConfigValueById(3);
$smarty->assign('footer_logo', $footer_logo['config_value']);

## Assign success or error msg to smarty variable and unset session variable
if(trim($_SESSION['msg']) != '') {
	$smarty->assign('msg', $_SESSION['msg']);
	unset($_SESSION['msg']);
}

## Unset all the objects created which are on this page
unset($adminObj);
unset($configObj);
unset($moduleObj);
	
## Include file which contains all the page names
require_once '../admin/includeFile.php';
?>